Program 		-> inicio Block fim

Block 			-> Declrations	Block     | Stmt_List Block          | Epsilon

Declarations	-> VarDecl Declarations   | SubprogDecl Declarations | TypeDecl Declarations | Epsilon

IdList			-> ID | IdList, ID

VarDecl 		-> Type ":" Id_List";" VarDecl | Type ":" Id_List ";"

Type 			-> Standard_Type | vetor "[" NUM ":" NUM "]" 

StandardType	-> inteiro | real | char | logico | ID

SubprogDecl		-> Subprog inicio Block fim

TypeDecl		-> tipo ID = registro VarDecl fimregistro;

Subprog			-> funcao ID Arguments ":" Standard_type ";" | procedimento ID Arguments ";"

Arguments 		-> "("Id_List")" | Epsilon  

Stmt_List		-> Statement | Statement ";"  | Statement ";" Stmt_List

Statement		-> Name <- Expression    | Proc_Stmt  | inicio Stmt_List fim | 
				   se Expression entao Statement senao Statement fimse|
				   se Expression entao Statement fimse |
				   enquanto Expression faca Statement fimenquanto|
				   seletor  Expression inicio CaseBlock fimseletor
				   quebrar	| leia (Expr_List)   |  imprima (Expr_list)

CaseBlock		-> caso Expression":" Stmt_List CaseBlock  | padrao":" Stmt_List CaseBlock

Proc_Stmt		-> ID | ID () | ID "("Expression")"

Expr_List		-> Expression | Expr_list"," Expression

Expression		-> Primary | UnaryOp expression | Expression BinOp Expression

Primary			-> Name | "(" Expression ")" | ID "("Expr_List")" | verdadeiro | falso | LITERAL | NUM

Name 			-> ID | ID "[" Exression "]" | Name"."Name

UnaryOp			-> "-" | nao | "+"

BinOp			-> "=" | "<" | ">" | "<=" | ">=" | ">" | "<>" | "+" | "-" | "*" | "/" | e | ou
